package com.game.business.controller;


import java.util.Arrays;
import java.util.List;
import java.io.IOException;

import com.game.common.annotation.Log;
import com.game.common.core.controller.BaseController;
import com.game.common.core.domain.AjaxResult;
import com.game.common.enums.BusinessType;
import com.game.common.utils.poi.ExcelUtil;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.game.business.domain.TDh;
import com.game.business.service.ITDhService;
import com.game.common.core.page.TableDataInfo;

/**
 * 君子币兑换配置Controller
 *
 * @author ruoyi
 * @date 2025-10-11
 */
@RestController
@RequestMapping("/business/jzbdh")
public class TDhController extends BaseController {
    @Autowired
    private ITDhService tDhService;

/**
 * 查询君子币兑换配置列表
 */
//@RequiresPermissions("business:jzbdh:list")
@GetMapping("/list")
    public TableDataInfo list(TDh tDh) {
        startPage();
        List<TDh> list = tDhService.selectTDhList(tDh);
        return getDataTable(list);
    }

    /**
     * 导出君子币兑换配置列表
     */
    //@RequiresPermissions("business:jzbdh:export")
    @Log(title = "君子币兑换配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TDh tDh) {
        List<TDh> list = tDhService.selectTDhList(tDh);
        ExcelUtil<TDh> util = new ExcelUtil<TDh>(TDh. class);
        util.exportExcel(response, list, "君子币兑换配置数据");
    }

    /**
     * 获取君子币兑换配置详细信息
     */
    //@RequiresPermissions("business:jzbdh:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(tDhService.getById(id));
    }

    /**
     * 新增君子币兑换配置
     */
    //@RequiresPermissions("business:jzbdh:add")
    @Log(title = "君子币兑换配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TDh tDh) {
        return toAjax(tDhService.save(tDh));
    }

    /**
     * 修改君子币兑换配置
     */
    //@RequiresPermissions("business:jzbdh:edit")
    @Log(title = "君子币兑换配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TDh tDh) {
        return toAjax(tDhService.updateById(tDh));
    }

    /**
     * 删除君子币兑换配置
     */
    //@RequiresPermissions("business:jzbdh:remove")
    @Log(title = "君子币兑换配置", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(tDhService.removeByIds(Arrays.asList(ids)));
    }
}
